#include<iostream>
#include<cstring>
using namespace std;

string s1,s2;

int gcd(int a,int b){
	if(a%b == 0){
		return b;
	}else{
		return gcd(b,a%b);
	}
}

int main(){
	cin>>s1>>s2;
	int t = 0;
	for(int i=0;i<s1.length();i++){
		if(s1[i] == s2[i])t++;
	}
	if(t == s1.length()){
		cout<<"AC"<<endl;
	}else{
		int ss = s1.length();
		int c = gcd(t,ss);
		cout<<t/c<<"/"<<ss/c<<endl;
	}
	return 0;
}
